using Microsoft.Practices.CompositeUI;
using Microsoft.Practices.ObjectBuilder;
using Jbe.TestSuite.Infrastructure.Interface;
using Jbe.TestSuite.TestDevice.Manager.Interface.Constants;

namespace Jbe.TestSuite.TestDevice.FunctionGen.Driver
{
    public class Module : ModuleInit
    {
        private WorkItem rootWorkItem;

        [InjectionConstructor]
        public Module([ServiceDependency] WorkItem rootWorkItem)
        {
            this.rootWorkItem = rootWorkItem;
        }

        public override void Load()
        {
            base.Load();

            WorkItem testDeviceWorkItem = rootWorkItem.WorkItems[WorkItemNames.TestDevice];
            ControlledWorkItem<ModuleController> workItem = testDeviceWorkItem.WorkItems.AddNew<ControlledWorkItem<ModuleController>>();
            workItem.Controller.Run();
        }
    }
}
